<template>
  <glsx-dialog :show="showPopup" title="修改密码" :show-close="false">
    <div class="">
      <UpdatePassword @change="onChange" />
    </div>
  </glsx-dialog>
</template>
<script>
import UpdatePassword from "@/views/system/password.vue";
export default {
  name: "PasswordDialog",
  components: {
    UpdatePassword,
  },
  props: {
    value: {
      type: Boolean,
      default: false,
    },
  },
  watch: {
    value: {
      handler: function (n) {
        this.showPopup = n;
      },
      immediate: true,
    },
  },
  data() {
    return {
      showPopup: true,
    };
  },
  methods: {
    // 修改密码成功
    onChange() {
      let m = sessionStorage.getItem("user");
      let user = m ? JSON.parse(m) : {};
      user.changePasswd = false;
      sessionStorage.setItem("user", JSON.stringify(user));
      this.$emit("input", false);
      this.showPopup = false;
    },
  },
};
</script>
<style lang="scss" scoped>
</style>